this._grid.x_expand = true;
this._items = new Map();
- this._allItems = [];
+ this._orderedItems = [];
}
_childFocused(_actor) {
}
_redisplay() {
- let oldApps = this._allItems.slice();
+ let oldApps = this._orderedItems.slice();
let oldAppIds = oldApps.map(icon => icon.id);
let newApps = this._loadApps().sort(this._compareItems);
// Remove old app icons
removedApps.forEach(icon => {
- let iconIndex = this._allItems.indexOf(icon);
+ let iconIndex = this._orderedItems.indexOf(icon);
let id = icon.id;
- this._allItems.splice(iconIndex, 1);
+ this._orderedItems.splice(iconIndex, 1);
icon.destroy();
this._items.delete(id);
});
addedApps.forEach(icon => {
let iconIndex = newApps.indexOf(icon);
- this._allItems.splice(iconIndex, 0, icon);
+ this._orderedItems.splice(iconIndex, 0, icon);
this._grid.addItem(icon, iconIndex);
this._items.set(icon.id, icon);
});
}
getAllItems() {
- return this._allItems;
+ return this._orderedItems;
}
_compareItems(a, b) {
_itemNameChanged(item) {
// If an item's name changed, we can pluck it out of where it's
// supposed to be and reinsert it where it's sorted.
- let oldIdx = this._allItems.indexOf(item);
- this._allItems.splice(oldIdx, 1);
- let newIdx = Util.insertSorted(this._allItems, item, this._compareItems);
+ let oldIdx = this._orderedItems.indexOf(item);
+ this._orderedItems.splice(oldIdx, 1);
+ let newIdx = Util.insertSorted(this._orderedItems, item, this._compareItems);
this._grid.removeItem(item);
this._grid.addItem(item, newIdx);
}
_refilterApps() {
- let filteredApps = this._allItems.filter(icon => !icon.visible);
+ let filteredApps = this._orderedItems.filter(icon => !icon.visible);
- this._allItems.forEach(icon => {
+ this._orderedItems.forEach(icon => {
if (icon instanceof AppIcon)
icon.visible = true;
});
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
- let numItems = this._allItems.length;
+ let numItems = this._orderedItems.length;
let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL;
for (let i = 0; i < 4; i++) {
let bin = new St.Bin({ width: subSize * scale, height: subSize * scale });
if (i < numItems)
- bin.child = this._allItems[i].app.create_icon_texture(subSize);
+ bin.child = this._orderedItems[i].app.create_icon_texture(subSize);
layout.attach(bin, rtl ? (i + 1) % 2 : i % 2, Math.floor(i / 2), 1, 1);
}